<?php
class info_collecting_day extends MY_Controller{
    var $data,
        $limit = 10;
    function info_collecting_day(){
        parent::MY_Controller();
        $this->data['title'] = "Informasi Collecting Day";
        $this->load->model('m_collecting_day');
    }
    function index(){
        $this->get_collecting_day('all',0);
    }
    function search(){
        $url = $this->input->post("url");
        $params = "awal_".date2mysql($this->input->post("awal"));
        $params .= "__akhir_".date2mysql($this->input->post("akhir"));
        
        redirect("$url/$params/0/");
    }
    function get_collecting_day($params = 'all',$offset = 0){
        $option = parsing_param2($params);
        $this->data['content'] = "collecting_day/info_collecting_day";
        $this->data['formTitle'] = "Parameter Pencarian";
        $this->data['searchLink'] = "info_collecting_day/get_collecting_day";
        $uri_segment = 4;
        if($offset != 0){
          $offset = $this->uri->segment($uri_segment);  
        }
        $num_rows = $this->m_collecting_day->getCountRows($option);
        $this->data['listCollectingDay'] = $this->m_collecting_day->getListCollectingDay($offset,$this->limit,$option);
        $config['base_url'] = site_url("info_collecting_day/get_collecting_day")."/".$params;
        $config['uri_segment'] = $uri_segment;
        $config['total_rows'] = $num_rows;
        $config['per_page'] = $this->limit;
        $this->pagination->initialize($config);
        $this->data['pagination'] = $this->pagination->create_links();
        $this->data['offset'] = $offset;
        
        $this->render($this->data);
    }
    function detail_collecting_day($id,$uri_segment){
        $this->data['content'] = "collecting_day/collectingDayInfo";
        $this->data['linkBack'] = "info_collecting_day/get_collecting_day/$uri_segment";
        $this->data['CollectingDayList'] = $this->m_collecting_day->detailCollectingDay($id);
        $this->render($this->data);
    }
    function print_collecting_day($params){
        $option = parsing_param2($params);
        $data['listCollectingDay'] = $this->m_collecting_day->getListCollectingDay(NULL,NULL,$option);
        
        $this->load->view('collecting_day/cetak_collecting_day',$data);
    }
    function export_data($params = 'all'){
        $option = parsing_param2($params);
        $data['data'] = $this->m_collecting_day->getListCollectingDay(NULL,NULL,$option);
        $data['params'] = $option;
        $this->load->view('collecting_day/cetak_excel',$data);
    }
}
?>
